--***************************************************************
--
-- Parameters:
-- ObjectName               = {PAGE_NAME}.asp
-- ObjectTypeName           = Data page
-- ScriptTree               = 0
-- ScriptOnlyActiveLanguage = 1
-- SetObjectGroups          = 1
-- LastModDate              = <NULL>
--
--***************************************************************

--*****************************************************************************************
--*** Main Object data {PAGE_NAME}.asp
--*****************************************************************************************

DECLARE @intObjID INT
DECLARE @blnIsNewObject BIT 
DECLARE @intRecTypeID INT
DECLARE @intRecFieldTypeID INT
DECLARE @intObjGrpID INT
DECLARE @txtHelpHtml NVARCHAR(4000)

-- New Object ID
EXEC @intObjID = sp_zObject_ID 'Object', '{PAGE_NAME}.asp'
EXEC @intRecTypeID = sp_zObject_ID 'RecordType', 't{RECORD_TYPE}', @vblnReturnNewID = 0

-- Force security settings, delete current object group memberships
DELETE FROM tzObjectGroupMember WHERE ObjID = @intObjID 
DELETE FROM tzObjectField WHERE ObjID = @intObjID 

---- Init ObjectGroupID
EXEC @intObjGrpID = sp_zObject_ID 'ObjectGroup', 'Admin Data - Employee core info', @vblnReturnNewID = 0
EXEC @intRecFieldTypeID = sp_zObject_ID 'RecordType', 't{RECORD_TYPE}', @vblnReturnNewID = 0

-- Keep existing Html help text
SELECT @txtHelpHtml = HelpHTML FROM tzObjectText WHERE ObjID = @intObjID AND SysLID = 1033
-- Execute Load SP
EXEC pzObject_Load @vintObjID = @intObjID, @vstrName = N'{PAGE_NAME}.asp', @vintObjTypeID = -1, @vintRecTypeID = @intRecTypeID, @vtxtComment = N'From to edit {PAGE_NAME}', @vstrFieldName = N'{PAGE_KEY}', @vintFieldRecTypeID = @intRecFieldTypeID, @vintObjGrpID = @intObjGrpID, @vstrObjGrpFieldName = N'{PAGE_KEY}', @vintSysLID = 1033, @vtxtHelpHtml = NULL
-- Reload existing Html help text
EXEC pzObjectText_Load @vintObjID = @intObjID, @vintSysLID = 1033, @vtxtHelpHtml = @txtHelpHtml


GO


--*****************************************************************************************
--*** Resource Text Data {PAGE_NAME}.asp
--*****************************************************************************************

DECLARE @intObjID INT
EXEC @intObjID = sp_zObject_ID 'Object', '{PAGE_NAME}.asp', @vblnReturnNewID = 0

EXEC pzResource_Load @vintObjID = @intObjID, @vstrResourceName = N'FormTitle', @vintSysLID = 1033, @vstrResourceDesc = NULL, @vstrResourceText = N'{PAGE_NAME}'
{SQL_OBJECT_RESOURCE}

GO

--DataPage
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DECLARE @intObjID INT

EXEC @intObjID = sp_zObject_ID 'Object', N'{PAGE_NAME}.asp', NULL, NULL, NULL, NULL, NULL, 0 
EXEC pzObjectDataPage_Load @vintObjID = @intObjID, @vblnIsSaveDataWarningEnabled = 1, @vblnIsLegalCheckOnSaveEnabled = 0, @vblnDisplayLegalCheckButton = 0, @vblnIsSpellCheckOnSaveEnabled = 0, @vblnDisplaySpellCheckButton = 0
GO


--DataPageControl
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


--Delete FileCategories
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DECLARE @intObjID INT

EXEC @intObjID = sp_zObject_ID 'Object', N'{PAGE_NAME}.asp', NULL, NULL, NULL, NULL, NULL, 0 
DELETE FROM tzObjectFileCategory WHERE ObjID = @intObjID
GO

--FileCategory
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

--Tree
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DECLARE @intCtTreeID INT
DECLARE @vintParentCtTreeID INT
DECLARE @intObjID INT
DECLARE @ridCtTreeGUID UNIQUEIDENTIFIER
DECLARE @strTreeNodeName NVARCHAR(255)

SET @strTreeNodeName = N'{PAGE_NAME}'
SET @ridCtTreeGUID = N'E0BBBA43-6561-4596-97C2-5E6D2A7B0D62'

EXEC @intObjID = sp_zObject_ID 'Object', N'{PAGE_NAME}.asp', NULL, NULL, NULL, NULL, NULL, 0
EXEC @intCtTreeID = sp_zObject_ID 'TreeByGuid', @ridCtTreeGUID
EXEC @vintParentCtTreeID = sp_zObject_ID 'TreeByGuid', N'FABDF121-DC13-4BBF-A235-64DB950030BF', NULL, NULL, NULL, NULL, NULL, 0
EXEC pzControllerTree_Load @intCtTreeID, 1033, @intObjID, @strTreeNodeName, NULL, N'/Skins/Default/img/TreeIconEmployeePage.gif', NULL, N'BannerType{{=}}1', NULL, 10, 0, @ridCtTreeGUID
EXEC pzControllerTree_Load2 @intCtTreeID, @vintParentCtTreeID, NULL
GO